import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';

import '../others/common_enum/cell_setting_type.dart';

// 设置Section模型
class SettingSectionModel {
  CellSectionType sectionType; // Section类型
  List<SettingRowModel> subItems; // 子项模型

  SettingSectionModel({
    required this.sectionType,
    required this.subItems,
  }) : assert(subItems.isNotEmpty,
            'SettingSectionModel subItems cannot be empty');
}

// 设置Row模型
class SettingRowModel {
  CellRowType rowType; // Row类型
  String title; // 标题
  String? value;
  bool? switchValue; // 开关类型的值
  Widget? leading; // 左侧组件
  Widget? trailing; // 右侧组件
  VoidCallback? onTap; // 点击回调
  Function(bool)? onChanged; // 开关类型的回调
  List<SettingRowModel> subItems; // 子项模型
  bool isMainRow; // 是否为主行

  SettingRowModel({
    required this.rowType,
    required this.title,
    this.value,
    this.switchValue = false,
    this.leading,
    this.trailing,
    this.onTap,
    this.onChanged,
    this.subItems = const [],
    this.isMainRow = true,
  });
}
